package com.example.swagger2.controller;

import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author alexhu
 */
@Api(tags = "样例Controller",value = "控制器Demo")
@RestController
public class ExampleController {

    @ApiOperation(value = "回显name",httpMethod = "GET")
    @GetMapping("/echo/{name}")
    public String echoName(@ApiParam(name = "name", value = "名字", required = true) @PathVariable("name") String name) {
        return "Echo " + name;
    }

    @ApiOperation(value = "问候name",httpMethod = "GET")
    @GetMapping("/hello")
    public String helloName(@ApiParam(name = "name", value = "名字", required = true) @RequestParam("name") String name) {
        return "Hello " + name;
    }
}
